package org.popupcommunication.web;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.ScriptAssert;
import org.springframework.stereotype.Component;

@ScriptAssert(
	lang="javascript",	
	script = "_this.confirmPassword.equals(_this.password)",
	message = "account.password.mismatch.message"
)

@Component
public class UserFormRegister {
	private String firstName, lastName,password,confirmPassword,email,confirmEmail,fonction,institution,tel,gsm,avatar;		

	@NotNull
	@Size(min=1,max=100)
	public String getFirstName() {
		return firstName;
	}

	@NotNull
	@Size(min=1,max=100)	
	public String getLastName() {
		return lastName;
	}	

	@NotNull
	@Size(min=1,max=20)		
	public String getPassword() {
		return password;
	}

	@NotNull
	@Size(min=1,max=20)		
	public String getConfirmPassword() {
		return confirmPassword;
	}
	
	@NotNull
	@Size(min=1,max=100)	
	@Email
	public String getEmail() {
		return email;
	}

	@NotNull
	@Size(min=1,max=100)	
	@Email	
	public String getConfirmEmail() {
		return confirmEmail;
	}	
	
	@Size(min=0,max=100)		
	public String getFonction() {
		return fonction;
	}
	
	@Size(min=0,max=100)	
	public String getInstitution() {
		return institution;
	}	

	@Size(min=0,max=20)
	public String getTel() {
		return tel;
	}

	@Size(min=0,max=20)	
	public String getGsm() {
		return gsm;
	}
	
	public String getAvatar(){
		return avatar;
	}
	
	public void setAvatar(String src){
		avatar=src;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setFonction(String fonction) {
		this.fonction = fonction;
	}

	public void setInstitution(String institution) {
		this.institution = institution;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public void setGsm(String gsm) {
		this.gsm = gsm;
	}

	public void setConfirmEmail(String confirmEmail) {
		this.confirmEmail = confirmEmail;
	}
	
	@Override
	public String toString() {
		return "UserFormAdmin [firstName=" + firstName + ", lastName="
				+ lastName + ", password=" + password + ", email=" + email
				+ ", fonction=" + fonction + ", institution=" + institution
				+ ", tel=" + tel + ", gsm=" + gsm + ", avatar="+avatar+"]";
	}

	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}	
}
